<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of system_view
 *
 * @author phamhphuc
 */
class system_view {
    
    protected static $_instance = null;
		
    private $_data = array ();
    private $_lang = array();

    public function __construct() {}

    public static function getInstance() {
        if (null === self::$_instance) {
                self::$_instance = new self ();
        }

        return self::$_instance;
    }

    public function getData() {
            return $this->_data;
    }

    public function __set($key, $value) {
            $this->_data [$key] = $value;
    }

    public function __get($key) {
            return $this->_data [$key];
    }
    
    public function t($word) {
        if(isset($this->_lang[$word])) {
            return $this->_lang[$word];
        }
        return $word;
    }
    
    public function sine($data, $val){
        if($val && ($val != "") && ($val != "<br>")){
            return str_replace("{var}", $val, $data);
        }
        return "";
    }
    
    public function setLanguageArray($array){
        $this->_lang = $array;
    }
}
?>
